package cn.tjie.basic.service.impl;

import cn.tjie.basic.service.IBaiduAiAuditService;
import cn.tjie.basic.util.BaiduAiUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

@Service
public class IBaiduAiAuditServiceImpl implements IBaiduAiAuditService {
    @Override
    public Boolean textAudit(String text) {
        return BaiduAiUtils.TextCensor(text);
    }

    @Override
    public Boolean imageAudit(String resources) {
        if(!StringUtils.isEmpty(resources)){
            String[] urls = resources.split(",");
            for (String url : urls) {
                if(!BaiduAiUtils.ImgCensor("http://123.207.27.208"+url)){
                    return false;
                }
            }
        }
        return true;
    }
}
